/* C05AJF Example Program C Version. NAG Copyright 1997. */ #include #include #include main() { double eps, eta, x; int ifail, k, nfmax; double f(double *); printf("C05AJF Example Program Results\n\n"); for (k=1; k<=2; k++) { eps = k==1 ? 0.1e-2 : 0.1e-3; x = 1.0; eta = 0.0; nfmax = 200; ifail = 1; /* Remove underscore as appropriate */ c05ajf_(&x,&eps,&eta,f,&nfmax,&ifail); if (ifail==0) printf("With eps = %e root = %f\n",eps,x); else { printf("ifail = %d\n",ifail); if (ifail==3 | ifail==4) printf("With eps = %e final value = %f\n",eps,x); } } } double f(double *x) { return exp(-*x) - *x; }